#include <stdio.h>
#include <stdlib.h>
#include "funcoesMemoria.h"
#include "repositorio.h"
#include "math.h"

int main()
{
    int h,i,j, experimento,tam = 24;
    int totalImagens = 556;//2458;//147;//556;//4548;

    int numPos = 36;
    int numNeg = 139;
    long faces = 0, naofaces = 0;
    double** teste;
    double* alfas;

    int indexTesteNeg[30][139] = {{50,533,120,526,542,130,146,138,553,59,231,497,273,178,8,117,208,465,265,326,483,172,269,296,303,264,232,484,374,207,164,26,233,278,191,244,91,302,358,90,537,132,454,330,33,504,9,210,80,99,10,74,508,525,349,455,206,116,96,288,256,166,37,199,439,306,307,136,112,6,329,420,148,251,119,109,528,239,480,45,176,274,517,411,258,473,393,76,89,135,522,157,220,87,241,320,247,474,446,509,133,341,266,43,39,512,461,511,84,477,213,29,398,540,422,221,418,173,316,343,378,155,380,163,38,28,534,48,97,121,150,532,415,311,548,170,242,392,382},{97,163,50,86,155,438,147,195,340,436,87,144,202,484,282,383,308,483,208,498,110,527,11,521,453,266,351,230,95,213,281,342,506,123,346,525,334,430,211,278,4,106,493,314,317,207,215,344,328,188,472,530,318,98,322,133,201,319,505,183,43,103,479,548,455,302,114,475,78,391,146,445,189,358,551,327,426,388,82,84,331,221,324,539,104,249,359,297,373,374,45,301,22,185,204,389,214,66,511,372,228,184,534,72,424,34,420,238,360,76,512,260,495,142,158,392,247,300,367,10,105,35,554,224,17,129,240,409,456,469,465,56,168,131,138,471,94,130,482},{513,87,428,201,202,345,370,307,404,528,79,166,341,382,112,416,130,269,270,537,224,239,261,339,10,219,312,175,425,114,424,393,192,552,343,441,305,381,63,384,119,279,445,313,462,65,374,368,21,163,357,144,209,152,46,154,479,258,90,276,131,429,497,353,141,394,364,229,232,217,66,545,518,446,251,311,526,136,7,492,101,365,285,507,407,333,502,412,292,260,397,199,400,33,538,280,108,330,274,256,512,139,203,489,243,532,197,461,223,335,142,215,450,110,463,468,278,20,257,406,478,427,334,315,9,104,211,122,14,106,420,165,220,534,297,170,143,349,115},{52,544,175,447,353,236,301,535,126,538,501,531,514,211,471,124,498,406,78,451,394,187,335,194,361,336,367,370,69,549,224,504,420,81,299,520,213,123,376,393,496,219,152,261,458,297,292,144,316,380,434,312,437,527,500,481,105,98,83,546,512,343,254,53,345,287,280,96,221,490,26,107,73,348,476,260,432,131,537,41,363,555,110,499,368,384,424,542,160,422,172,164,227,51,517,354,482,510,382,487,97,99,475,405,235,430,257,13,279,240,356,226,64,252,402,29,118,262,166,317,342,462,46,369,104,217,157,359,474,63,329,465,493,115,358,454,530,554,20},{174,344,290,476,61,305,31,108,79,431,477,246,385,94,127,343,9,512,240,167,251,510,23,299,232,451,450,29,193,481,133,135,201,315,500,98,550,397,412,190,346,138,153,77,341,4,333,470,485,480,131,72,525,534,296,41,45,319,1,342,22,314,50,243,404,185,67,513,59,503,104,70,367,393,39,66,255,517,490,454,264,11,373,475,420,265,100,267,237,371,523,300,374,433,256,134,139,329,119,140,175,84,249,169,430,493,494,383,495,279,141,275,47,524,283,391,76,515,429,395,468,544,75,474,170,160,82,87,18,90,259,181,15,375,93,355,518,180,269},{222,64,287,171,357,194,262,48,543,3,115,237,378,66,327,515,259,335,60,415,310,447,353,533,545,467,328,235,6,75,528,500,361,24,389,211,250,536,464,526,496,529,18,2,303,40,344,546,232,383,143,299,155,120,274,271,488,352,308,392,180,490,477,5,508,527,52,305,448,539,324,199,139,277,27,162,82,161,81,421,478,121,541,203,117,77,359,230,371,547,363,59,365,137,208,247,454,390,36,331,165,325,243,141,145,438,17,47,278,387,444,189,388,229,424,202,130,514,411,409,275,542,486,429,283,398,302,188,132,472,414,293,449,19,506,127,336,550,555},{374,92,122,302,392,151,126,262,337,132,165,22,127,117,384,445,288,222,251,230,326,504,180,364,553,37,444,270,414,432,405,3,435,64,381,53,77,366,201,128,155,325,247,361,187,63,23,298,347,331,523,68,98,207,478,327,166,261,103,489,116,8,24,260,196,174,31,458,238,229,265,280,357,136,59,36,46,111,263,51,282,438,519,144,421,459,479,368,322,208,259,223,395,134,188,5,72,94,170,218,425,303,129,7,294,462,33,278,213,537,204,21,79,124,226,396,386,50,413,348,258,465,249,533,453,121,512,42,87,32,287,74,234,268,493,388,153,104,114},{79,364,488,540,402,372,63,421,463,556,124,302,246,319,456,200,196,84,430,440,551,489,353,397,522,228,311,292,11,118,191,473,453,211,531,121,60,407,153,32,165,492,188,328,57,327,22,510,516,338,89,156,208,180,38,30,315,476,50,251,466,220,443,65,125,241,223,416,494,486,61,289,470,403,62,268,155,40,422,371,204,477,35,313,213,4,207,78,42,542,305,529,548,382,461,151,113,352,326,141,432,91,533,102,344,68,219,86,527,428,252,210,132,526,288,73,334,343,395,502,368,146,37,235,283,356,544,355,187,83,297,493,455,525,359,471,152,286,339},{262,67,172,5,241,377,390,166,321,18,228,337,191,93,95,159,367,230,91,350,253,476,54,53,529,417,199,298,359,532,421,136,105,272,508,256,342,174,548,129,32,149,117,322,153,158,464,62,7,94,221,269,103,77,284,205,410,15,74,160,178,38,311,525,555,217,86,391,128,295,494,507,25,423,320,249,513,111,212,79,76,267,155,357,21,131,254,309,247,314,533,169,305,81,187,225,505,511,106,255,196,399,151,520,2,297,522,477,430,436,439,483,486,416,515,360,223,190,264,400,339,165,273,435,39,493,231,232,13,192,177,107,408,412,286,48,308,88,1},{356,345,420,496,508,32,135,82,45,458,154,505,459,254,327,194,178,416,54,419,24,421,182,68,471,157,306,211,166,42,360,71,340,159,16,322,524,174,446,290,485,59,424,307,142,519,313,366,259,280,257,279,160,20,271,506,316,247,382,64,298,478,270,333,358,146,141,535,18,435,43,376,487,318,265,460,10,396,411,196,53,131,163,538,515,436,539,380,198,51,79,543,207,243,339,249,189,223,346,335,523,38,500,483,195,452,102,377,526,371,258,127,237,348,62,310,37,311,106,179,36,94,112,352,275,431,235,369,129,349,184,518,97,49,372,467,330,240,514},{457,188,237,318,491,471,500,187,549,264,443,267,404,533,356,185,14,175,420,177,226,47,162,466,260,295,207,421,525,381,99,484,7,49,69,348,213,6,66,359,333,445,414,387,349,117,473,382,418,249,472,196,410,88,233,397,279,354,335,215,451,509,18,432,431,528,336,468,27,54,168,400,441,454,304,530,272,547,444,126,314,415,257,180,23,428,90,360,255,50,131,275,322,156,438,364,501,103,45,240,209,72,316,278,498,287,71,553,256,294,416,94,224,262,80,413,106,379,541,496,394,77,125,552,59,531,26,313,32,52,463,141,369,29,56,41,467,112,448},{169,132,54,519,228,473,294,384,91,486,145,59,156,104,45,375,531,224,401,221,339,167,478,42,189,71,182,159,125,29,244,270,115,259,520,365,463,47,435,536,351,548,136,454,516,318,134,367,538,192,4,495,391,457,94,120,326,34,231,381,330,245,198,164,550,235,427,353,309,496,121,277,127,62,390,200,286,208,24,8,163,215,201,446,289,276,537,33,513,241,1,56,282,183,447,484,254,81,152,283,369,75,539,371,342,219,507,128,16,525,175,232,268,256,423,262,407,233,306,301,278,310,181,466,187,93,467,451,503,263,343,316,222,95,48,542,52,320,540},{527,518,217,543,208,323,174,508,243,61,192,302,117,503,477,293,102,11,459,554,305,295,403,42,542,73,66,93,6,378,415,30,538,170,482,534,247,380,540,476,261,63,267,469,98,213,346,296,4,384,113,77,276,372,338,419,105,165,54,407,263,212,48,233,500,211,47,91,120,329,35,523,350,460,50,191,429,321,483,84,187,232,327,297,147,455,133,244,354,52,383,360,307,553,155,497,239,539,367,548,209,210,358,405,424,435,478,492,31,205,371,45,526,78,80,394,544,75,46,291,450,456,21,2,437,465,144,300,550,44,248,167,515,143,49,252,422,309,154},{409,134,174,71,69,142,73,370,141,126,528,325,442,306,266,215,219,324,52,483,276,97,347,360,57,94,9,53,426,522,17,535,245,185,45,264,321,382,183,115,106,367,516,539,311,147,362,279,233,250,10,220,228,343,366,502,159,218,553,288,510,515,520,482,293,486,77,199,195,312,42,197,38,523,116,334,441,70,465,456,209,1,207,92,193,330,125,211,476,508,287,118,263,390,534,398,402,346,451,179,47,32,105,36,349,86,403,128,310,117,477,15,307,469,59,479,267,79,20,422,544,289,506,380,381,192,326,302,181,385,205,140,208,429,22,24,170,76,249},{111,443,127,362,408,453,419,404,172,215,113,549,276,29,304,422,451,194,206,381,39,171,168,207,235,490,421,165,450,128,138,372,301,351,512,517,115,49,313,452,493,21,407,460,288,305,120,4,78,480,350,402,176,12,367,151,355,220,114,13,435,178,425,123,297,132,310,77,52,401,150,534,44,257,489,252,289,117,155,324,139,383,410,331,434,303,245,365,342,3,544,400,498,520,307,396,286,34,264,47,329,241,265,541,14,271,334,173,243,371,487,202,251,183,98,308,161,411,204,237,556,315,466,177,506,74,387,270,107,456,213,239,90,424,221,503,382,62,85},{311,263,28,409,105,373,140,204,262,537,313,351,454,153,200,272,525,254,482,214,367,345,102,75,77,57,141,326,368,520,552,223,216,5,232,202,410,433,81,529,440,274,534,151,453,363,312,158,416,9,154,399,206,44,354,315,444,350,294,448,401,186,332,379,496,308,185,427,464,87,69,92,22,380,490,201,116,125,481,523,250,147,51,33,221,179,518,324,325,205,407,109,293,118,355,484,174,394,446,191,83,265,402,181,217,418,255,457,535,198,492,548,330,437,245,177,73,524,428,406,364,318,32,45,234,29,398,349,489,483,508,62,226,302,388,2,320,445,207},{240,124,197,28,480,542,451,92,184,446,404,327,69,501,85,47,491,286,23,314,233,308,113,502,534,232,527,25,436,338,125,350,33,494,110,293,86,514,59,229,221,243,435,306,364,219,156,179,461,521,205,329,458,478,6,252,507,532,529,244,523,149,235,48,189,449,533,375,485,342,52,496,328,304,282,101,551,415,132,88,505,307,316,492,264,519,214,419,173,100,455,144,413,288,524,154,170,39,417,102,456,56,395,355,423,38,37,96,368,441,217,280,336,251,335,351,407,152,13,517,344,460,153,391,238,209,60,324,57,315,396,431,20,476,211,253,77,41,50},{440,393,259,102,288,131,65,185,361,369,134,445,258,544,494,313,9,69,304,59,74,339,292,82,247,481,243,135,205,312,335,75,365,38,421,370,534,92,146,439,372,63,272,550,186,376,529,334,448,40,147,219,366,249,81,530,52,301,31,98,380,23,20,156,516,138,241,509,291,57,22,240,294,34,43,104,543,506,524,477,172,142,498,83,106,290,553,415,513,447,196,488,295,189,7,99,495,514,60,13,181,158,100,101,507,32,548,177,427,67,137,118,229,53,190,321,261,225,195,162,257,4,402,546,541,299,210,377,353,552,296,2,212,286,327,348,260,248,110},{225,156,30,321,436,302,110,307,375,265,354,350,399,161,170,189,262,527,212,115,45,50,457,1,34,111,328,468,440,106,118,326,553,133,69,352,502,259,467,247,462,496,432,83,367,198,211,426,425,63,52,486,488,500,47,495,221,5,10,332,99,479,29,514,421,20,524,49,68,473,414,498,3,245,392,55,386,424,521,318,430,304,533,365,380,205,112,546,497,540,501,146,416,319,98,284,377,180,264,32,190,409,36,300,215,13,253,335,368,171,477,455,183,40,418,166,71,534,17,267,469,275,492,62,315,206,89,446,235,439,518,485,382,134,59,470,363,2,73},{531,277,26,407,460,307,25,275,251,551,99,381,279,434,435,355,171,254,21,20,473,481,267,427,312,213,105,545,18,325,296,411,480,425,14,238,508,490,33,234,51,259,315,342,361,430,235,505,39,345,4,390,458,161,346,418,550,118,433,404,148,194,501,270,528,149,269,398,472,210,135,268,137,178,229,82,518,534,69,554,374,121,488,273,328,401,144,492,264,38,556,89,15,246,260,506,426,377,533,410,397,70,337,59,281,495,529,204,363,174,79,394,87,367,212,366,395,415,168,113,272,428,463,182,446,130,133,62,128,537,214,274,436,387,90,207,43,280,373},{60,295,303,291,332,255,232,358,364,489,234,50,424,320,175,271,201,480,53,462,242,152,100,391,57,61,355,93,326,299,245,32,507,6,437,222,444,249,312,244,111,33,103,405,275,195,182,339,193,17,331,415,140,261,265,176,256,354,198,12,292,48,125,38,329,199,417,513,277,169,129,376,527,352,282,165,254,530,519,483,386,258,168,455,422,468,508,146,460,106,419,74,309,300,375,227,476,162,396,9,190,321,482,470,538,18,21,202,185,218,78,471,443,132,553,305,158,170,286,528,14,13,178,288,213,192,370,204,474,172,289,65,484,177,166,263,267,200,188},{501,194,166,307,11,25,367,178,314,293,316,1,448,202,378,266,93,492,245,398,26,514,427,503,452,308,387,209,13,18,505,96,534,83,264,441,274,481,116,369,239,152,140,223,510,92,231,528,88,300,120,474,434,488,395,358,493,214,502,469,91,205,219,337,471,554,512,117,509,473,281,76,66,480,84,168,138,217,468,186,34,483,500,331,157,371,286,8,137,259,40,408,289,64,433,192,111,53,443,82,23,94,49,165,128,544,197,442,4,374,151,384,9,86,354,486,127,226,213,297,366,386,16,212,181,311,222,110,48,106,324,5,118,349,103,497,162,432,550},{428,333,153,513,258,235,17,139,261,112,188,120,316,122,117,407,144,224,427,356,51,459,181,167,437,115,342,521,537,67,124,140,148,396,413,146,58,138,424,103,444,169,281,92,403,361,23,536,360,2,492,192,327,53,63,475,80,177,73,461,114,376,134,469,353,319,398,104,109,162,271,535,238,416,190,429,106,483,288,347,412,414,81,436,233,298,241,154,499,519,445,317,39,70,15,388,107,491,450,526,370,322,380,164,48,243,291,308,447,249,34,237,458,86,446,350,152,196,306,66,32,439,441,522,478,551,182,128,179,257,408,310,21,203,95,130,205,352,132},{160,191,54,105,415,270,162,406,296,464,356,129,210,383,352,311,159,533,1,199,3,179,189,420,367,218,483,362,510,387,34,86,437,396,109,502,14,400,156,390,96,290,108,531,359,124,42,138,87,336,365,25,332,460,264,128,354,212,351,276,457,151,421,501,97,52,256,556,376,473,220,147,552,479,497,80,104,350,133,465,337,226,132,214,188,48,545,401,254,192,121,382,111,167,196,142,500,238,89,150,223,388,456,19,525,523,103,269,249,433,459,511,431,513,295,146,27,17,61,39,100,466,341,76,262,90,379,435,95,470,313,316,315,348,155,66,127,394,393},{337,396,48,365,202,213,303,307,156,42,545,136,201,66,283,419,191,197,294,393,232,507,173,207,52,9,192,142,175,493,483,206,214,43,479,75,452,250,251,331,10,485,436,498,423,245,1,417,386,238,492,455,373,211,306,34,219,200,488,4,181,413,126,100,402,263,554,141,105,375,8,308,55,446,253,411,63,280,508,440,68,486,284,476,212,271,31,13,467,225,533,534,473,83,56,503,385,556,187,234,322,480,134,482,465,185,101,149,23,450,434,526,313,193,310,237,518,102,339,279,431,40,97,89,275,474,291,240,501,481,387,398,374,157,270,497,129,369,448},{74,482,542,471,267,71,529,485,313,445,77,129,533,353,276,202,479,265,80,55,16,521,231,246,368,66,470,223,148,238,38,204,486,400,330,99,461,31,88,198,179,383,344,32,508,448,92,175,285,226,391,146,552,4,321,271,377,545,322,221,228,457,417,106,91,358,490,464,268,269,549,10,547,410,454,516,48,401,102,338,524,186,168,201,51,249,411,468,421,296,329,395,333,381,109,53,139,300,441,394,352,475,113,424,528,408,425,355,59,324,240,22,398,382,459,308,477,320,149,245,166,536,436,555,247,512,286,319,349,153,215,472,64,194,433,242,46,251,264},{426,402,212,383,167,51,281,396,196,454,127,32,118,221,102,465,362,188,246,447,241,303,187,334,552,86,413,452,155,140,19,540,9,529,223,397,261,360,526,293,493,185,345,256,99,432,207,392,39,153,381,121,524,76,393,547,325,332,248,498,20,415,125,114,242,504,11,105,23,100,177,46,412,165,52,92,277,434,479,128,467,194,453,145,98,419,176,24,264,473,38,359,197,265,363,208,361,257,468,152,95,418,1,352,394,316,401,137,168,448,267,329,509,478,385,65,113,543,456,537,175,398,551,336,231,259,506,275,549,428,227,234,411,201,154,91,40,533,49},{448,161,133,352,302,253,353,113,108,166,346,148,320,430,500,544,170,97,365,522,453,322,44,317,519,359,258,71,399,539,380,381,2,378,280,55,85,326,499,134,463,221,186,142,454,191,15,333,537,92,447,329,209,552,11,204,8,34,245,517,441,100,214,305,306,163,150,470,516,335,69,293,53,197,131,466,210,390,143,474,316,538,445,493,136,243,123,337,432,486,496,16,228,149,360,534,303,152,416,283,314,387,435,233,408,518,247,374,344,288,41,491,533,202,543,400,290,455,3,487,279,135,321,255,458,28,521,433,165,368,510,101,351,542,205,456,117,115,528},{381,463,128,520,3,308,4,195,356,442,322,460,401,205,351,365,138,219,169,400,129,11,107,357,295,78,135,211,75,68,368,377,428,341,234,32,500,180,412,464,191,451,206,95,535,286,410,539,231,370,534,399,462,88,325,393,146,101,526,229,202,93,354,100,265,540,507,523,278,14,367,420,297,336,510,38,254,371,450,89,148,294,323,360,282,287,218,224,113,508,127,72,84,374,283,380,358,366,480,145,321,13,81,482,454,375,455,253,385,485,298,403,60,275,272,20,140,248,404,163,252,285,104,62,388,83,340,47,421,456,207,499,427,405,296,327,264,543,270},{416,14,503,375,126,16,123,286,513,40,194,189,404,18,315,246,394,395,408,333,20,253,398,47,397,491,549,187,504,161,193,168,135,306,289,102,298,239,543,138,23,232,294,453,525,483,42,439,355,174,534,472,144,141,71,212,450,486,354,106,383,451,269,224,49,139,100,22,182,429,44,370,456,496,393,198,547,10,31,303,321,230,414,406,115,373,509,449,89,415,390,344,69,382,392,381,136,157,332,207,484,360,191,75,411,312,531,478,523,481,369,522,27,45,265,345,55,337,499,167,132,101,81,73,313,410,541,248,192,507,113,25,455,28,48,527,510,240,13}};
    //int indexTesteNeg[] = {15,454,286,492,485,539,99,295,12,34,520,374,263,73,102,501,67,342,382,387,513,432,306,363,43,450,329,457,307,499,106,11,347,304,497,287,289,542,37,319,412,434,480,389,103,193,392,8,261,496,249,323,380,86,7,540,93,376,545,512,262,466,398,68,533,280,372,63,439,205,333,177,186,464,96,489,493,78,458,216,502,403,165,384,527,234,405,350,195,4,84,18,373,332,346,29,308,206,470,488,98,152,122,212,503,547,126,288,120,235,174,314,327,433,349,80,209,456,532,531,294,544,100,423,35,548,386,459,242,377,277,303,147,393,268,320,519,468};
    //int indexTesteNeg[] = {306,271,259,181,201,281,80,150,74,241,513,121,36,252,507,343,75,278,65,140,495,517,31,425,544,50,125,455,417,68,529,246,55,164,549,211,410,311,160,156,210,3,127,382,471,217,35,381,314,144,119,272,291,445,261,247,473,496,27,467,316,100,138,359,310,72,364,336,163,518,274,551,397,268,54,224,215,149,19,253,312,349,34,383,435,256,290,412,118,200,175,107,524,538,166,248,320,216,501,240,196,221,199,545,491,176,245,512,420,43,554,502,87,147,365,393,380,346,447,93,66,466,459,439,214,385,400,116,527,76,303,461,542,285,190,532,255,367,411,438,153,170,436,179,129,541,476,390,504,372,348,205,477,405,386,413,555,547,543,531,130,457,21,257,460,432,148,375,421,146,108,195,286,444,122,423,275,296,451,520,238,110,6,193,293,458,162,508,284,454,327,488,82,113,17,67,98,506,62,376,468,360,12,341,178,304,287,171,71,132,374,394,369,407,537,69,522,333,416,189,128,297,335,309,481,395,169,220,136,362,145,231,64,540,339,131,267,79,430,434,229,515,157,85,40,60,497,325,453,433,37,528,219,58,288,185,361,353,15,535,441,510,242,307,4,295,97,222,292,13,234,511,7,208,184,377,450,277,203,96,5,117,356,464,523,373,133,472,280,123,114,151,161,530,509,84,159,283,498,479,212,494,191,46,112,344,230,525,366,192,486,370,258,337,186,2,516,206,483,194,168,443,45,264,228,244,101,172,126,142,492,263,514};
    //int indexTeste[] = {72,127,10,82,97,144,117,29,24,147,23,55,143,98,62,46,8,53,40,116,132,140,9,119,142,122,137,113,5,81,118,93,39,69,114,102};
    int indexTestePos[30][36] = {{92,113,35,19,146,97,17,128,81,5,41,73,107,78,102,57,105,43,82,21,80,88,127,55,26,49,115,145,32,76,142,94,38,79,70,27},{7,116,55,117,138,112,36,75,145,94,108,110,87,38,74,50,60,70,61,89,95,10,14,100,37,49,19,73,91,78,84,30,102,141,33,63},{137,75,112,139,71,96,43,116,120,129,4,142,27,67,78,35,62,77,18,126,103,68,23,94,25,98,44,58,51,24,105,53,83,6,60,2},{52,77,35,68,70,129,125,126,40,119,65,41,17,61,5,34,84,19,67,26,86,45,46,91,122,95,60,88,51,99,6,72,38,57,9,7},{89,53,101,140,12,96,41,117,18,81,36,76,147,105,131,132,108,98,141,134,54,97,33,84,37,138,10,57,28,102,128,60,115,46,40,3},{102,120,105,7,144,142,57,45,137,55,18,89,43,12,62,8,80,34,136,143,107,42,53,103,100,32,54,64,82,78,93,79,41,27,130,6},{147,46,97,141,108,26,53,145,36,121,102,56,86,101,28,82,41,64,144,30,112,34,105,22,119,49,67,109,74,7,110,142,130,35,128,16},{88,75,87,22,15,11,2,103,133,135,6,140,23,7,5,78,20,105,100,139,64,124,101,82,86,114,145,126,44,93,71,48,31,69,18,98},{134,20,29,144,40,131,26,37,19,56,96,101,44,49,39,94,138,70,135,32,21,31,30,12,63,124,18,61,137,50,116,123,13,114,128,16},{63,124,39,8,102,68,73,147,85,111,80,56,104,90,18,37,131,118,78,49,12,119,91,52,71,106,126,84,47,9,133,62,98,107,6,55},{53,89,55,14,72,47,18,104,29,112,71,139,81,44,41,93,101,11,58,45,94,120,19,26,96,107,75,39,132,86,17,129,35,22,82,2},{22,89,5,48,102,19,78,24,28,129,105,146,92,9,84,12,45,106,54,37,27,82,124,145,18,134,35,103,113,26,1,81,123,127,87,142},{66,83,60,137,133,50,86,81,11,109,49,48,14,100,54,90,105,35,73,72,71,145,65,77,142,89,7,92,67,15,32,75,112,59,16,98},{20,89,86,129,75,56,4,116,53,82,47,8,109,92,58,38,22,90,23,35,100,31,50,67,29,1,128,9,34,95,66,142,119,131,19,112},{44,106,105,41,113,98,25,100,17,76,118,8,96,10,57,147,15,129,65,107,141,135,101,119,142,79,67,123,134,138,63,87,56,6,139,72},{67,58,147,19,70,16,5,52,47,11,83,140,33,138,43,118,79,49,93,105,136,78,114,89,132,2,85,50,94,107,82,109,73,80,97,74},{47,108,91,66,104,4,70,44,136,84,78,118,100,16,86,69,109,38,34,10,93,6,63,45,120,25,106,75,119,122,18,24,107,110,81,67},{11,28,36,110,20,121,25,119,88,134,51,84,114,86,80,81,70,109,39,46,24,43,8,77,141,59,91,52,147,66,54,128,64,4,45,95},{102,31,26,56,100,123,79,21,147,47,67,2,119,111,137,84,142,50,77,143,17,118,144,27,53,98,129,36,43,99,78,22,114,13,115,63},{72,8,74,26,97,24,137,103,125,110,81,90,71,139,145,100,88,6,41,28,78,119,111,31,49,35,64,136,9,69,82,7,1,134,96,59},{123,87,17,122,124,19,89,23,99,79,16,46,66,63,34,142,20,91,49,136,98,33,3,88,68,125,32,56,52,143,127,130,11,22,50,82},{74,62,141,78,101,134,63,7,34,144,40,65,32,9,6,76,90,143,138,18,117,72,16,49,104,84,137,81,95,5,129,53,123,132,140,2},{26,96,143,133,8,28,102,48,56,16,104,10,12,81,24,63,73,92,83,71,123,5,29,87,145,116,126,46,52,108,128,27,134,90,25,54},{128,80,28,9,24,58,37,65,121,39,21,70,146,103,18,26,117,116,53,6,72,147,35,134,29,46,106,109,87,112,84,22,129,120,145,27},{36,86,5,2,93,80,18,137,97,109,71,45,39,15,117,78,85,131,10,133,47,54,26,61,140,77,134,96,90,125,20,9,41,107,38,60},{41,57,3,76,37,87,137,42,116,146,54,27,23,11,82,13,81,47,142,104,145,48,61,71,84,67,64,19,44,21,75,9,66,7,73,25},{79,134,130,71,119,144,146,78,147,15,102,129,124,12,99,64,140,53,13,136,18,77,127,73,142,94,139,39,16,126,19,115,62,31,10,28},{99,89,80,134,34,40,26,38,120,2,91,21,117,55,130,44,17,90,61,124,136,30,58,113,78,20,95,116,119,16,102,62,27,59,133,23},{142,99,72,23,31,90,110,106,25,137,54,102,85,123,107,44,97,4,80,46,87,35,96,143,112,48,122,92,53,45,21,9,145,19,126,100},{124,125,2,67,61,119,83,96,13,68,30,71,59,127,25,88,126,41,19,137,56,82,95,79,80,65,85,20,138,46,103,28,100,50,6,111}};
    //char caminhosAlfa[30]={};
    //char caminhosClass[30] = {};
    //char* caminhosAlfa[]= {"alfas (1).aad","alfas (2).aad","alfas (3).aad","alfas (4).aad","alfas (5).aad","alfas (6).aad","alfas (7).aad","alfas (8).aad","alfas (9).aad","alfas (10).aad","alfas (11).aad","alfas (12).aad","alfas (13).aad","alfas (14).aad","alfas (15).aad","alfas (16).aad","alfas (17).aad","alfas (18).aad","alfas (19).aad","alfas (20).aad","alfas (21).aad","alfas (22).aad","alfas (23).aad","alfas (24).aad","alfas (25).aad","alfas (26).aad","alfas (27).aad","alfas (28).aad","alfas (29).aad","alfas (30).aad"};
    //char* caminhosClass[] = {"classificadores_fortes (1).ada","classificadores_fortes (2).ada","classificadores_fortes (3).ada","classificadores_fortes (4).ada","classificadores_fortes (5).ada","classificadores_fortes (6).ada","classificadores_fortes (7).ada","classificadores_fortes (8).ada","classificadores_fortes (9).ada","classificadores_fortes (10).ada","classificadores_fortes (11).ada","classificadores_fortes (12).ada","classificadores_fortes (13).ada","classificadores_fortes (14).ada","classificadores_fortes (15).ada","classificadores_fortes (16).ada","classificadores_fortes (17).ada","classificadores_fortes (18).ada","classificadores_fortes (19).ada","classificadores_fortes (20).ada","classificadores_fortes (21).ada","classificadores_fortes (22).ada","classificadores_fortes (23).ada","classificadores_fortes (24).ada","classificadores_fortes (25).ada","classificadores_fortes (26).ada","classificadores_fortes (27).ada","classificadores_fortes (28).ada","classificadores_fortes (29).ada","classificadores_fortes (30).ada"};
    char* caminhosAlfa[] = {"alfas/alfas (1).aad","alfas/alfas (2).aad","alfas/alfas (3).aad","alfas/alfas (4).aad","alfas/alfas (5).aad","alfas/alfas (6).aad","alfas/alfas (7).aad","alfas/alfas (8).aad","alfas/alfas (9).aad","alfas/alfas (10).aad","alfas/alfas (11).aad","alfas/alfas (12).aad","alfas/alfas (13).aad","alfas/alfas (14).aad","alfas/alfas (15).aad","alfas/alfas (16).aad","alfas/alfas (17).aad","alfas/alfas (18).aad","alfas/alfas (19).aad","alfas/alfas (20).aad","alfas/alfas (21).aad","alfas/alfas (22).aad","alfas/alfas (23).aad","alfas/alfas (24).aad","alfas/alfas (25).aad","alfas/alfas (26).aad","alfas/alfas (27).aad","alfas/alfas (28).aad","alfas/alfas (29).aad","alfas/alfas (30).aad"};
    char* caminhosClass[] = {"classifiers/classificadores_fortes (1).ada","classifiers/classificadores_fortes (2).ada","classifiers/classificadores_fortes (3).ada","classifiers/classificadores_fortes (4).ada","classifiers/classificadores_fortes (5).ada","classifiers/classificadores_fortes (6).ada","classifiers/classificadores_fortes (7).ada","classifiers/classificadores_fortes (8).ada","classifiers/classificadores_fortes (9).ada","classifiers/classificadores_fortes (10).ada","classifiers/classificadores_fortes (11).ada","classifiers/classificadores_fortes (12).ada","classifiers/classificadores_fortes (13).ada","classifiers/classificadores_fortes (14).ada","classifiers/classificadores_fortes (15).ada","classifiers/classificadores_fortes (16).ada","classifiers/classificadores_fortes (17).ada","classifiers/classificadores_fortes (18).ada","classifiers/classificadores_fortes (19).ada","classifiers/classificadores_fortes (20).ada","classifiers/classificadores_fortes (21).ada","classifiers/classificadores_fortes (22).ada","classifiers/classificadores_fortes (23).ada","classifiers/classificadores_fortes (24).ada","classifiers/classificadores_fortes (25).ada","classifiers/classificadores_fortes (26).ada","classifiers/classificadores_fortes (27).ada","classifiers/classificadores_fortes (28).ada","classifiers/classificadores_fortes (29).ada","classifiers/classificadores_fortes (30).ada"};

    for (experimento = 0; experimento<30; experimento++){

        //char* caminhoClass = "classificadores_fortes.ada";
        char* caminhoClass = caminhosClass[experimento];
        char* caminhoAlfa = caminhosAlfa[experimento];
        //char* caminhoAlfa = "alfas.aad";
        int count = carregaQuantidadeClassificadoresFortes(caminhoClass);
        alfas = (double*) malloc (count*sizeof(double));
        alfas = carregaAlfas(count,caminhoAlfa);

        teste = (double**) malloc (tam*sizeof(double*));
        for (i = 0; i < tam; i++)
            teste[i] = (double*) malloc (tam*sizeof(double));
        //descomente para testar as negativas
        //for (h = 0; h <numPos; h++){
        //descomente para testar as positivas
        for (h = 0; h <numNeg; h++){
            //printf("index = %d",h);
            //abreFacesIntegrais(teste, indexTestePos[experimento][h], tam, tam);
            abreNaoFacesIntegrais(teste, indexTesteNeg[experimento][h], tam, tam);
            //printf("(h = %d) ", indexTeste[h]);
            //printf("\n%s",caminhoAlfa);
            if (classificadorForte(teste, count,caminhoClass,caminhoAlfa) == 1){
                //printf("Face.\n");
                faces++;
            }else{
                //printf("Nao face.\n");
                naofaces++;
            }
        }

        //printf("Estatisticas:\n\tTotal de Imagens = %ld\n\tCaracterizadas como faces = %ld (%lf%%)\n\tCaracterizadas como nao faces = %ld (%lf%%)", (faces+naofaces), faces, ((double) faces*100/(faces+naofaces)), naofaces, ((double) naofaces*100/(faces+naofaces)));
        printf("%ld\t%ld\n",faces, naofaces);
        for (i = 0; i < tam; i++)
            free (teste[i]);
        free (teste);
        faces = 0;
        naofaces = 0;
        free(alfas);

    }

    return 0;
}
